package com.topofstack.flp.ui;

import com.bappi.custom.activities.CustomTabActivity;
import com.topofstack.flp.R;

import android.os.Bundle;
import android.content.ComponentName;
import android.content.Intent;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;

public class HomeActivity extends CustomTabActivity {
	private static final String[] TABS = { "Tab1", "Tab2", "Tab3", "Tab4" };

private static final String[] TAB_TITLES = { "Photos", "Videos", "Notes",
	"Settings"};

private TabHost tabs = null;

public void changeTab(int index) {
tabs.setCurrentTab(index);
}

@Override
public void onCreate(Bundle icicle) {
try {
	super.onCreate(icicle);
	setContentView(R.layout.layout_home);
	setDefaultTab(0);
	tabs = getTabHost();
	for (int i = 0; i < TABS.length; i++) {
		TabHost.TabSpec tab = tabs.newTabSpec(TABS[i]);

		ComponentName oneActivity = new ComponentName(getApplication()
				.getPackageName(), getApplication().getPackageName()
				+ "." + TABS[i]);

		tab.setContent(new Intent().setComponent(oneActivity));
		int id = R.drawable.landscape;
		switch (i) {
		case 0:
			id = R.drawable.landscape;
			break;
		case 1:
			id = R.drawable.movie_1;
			break;
		case 2:
			id = R.drawable.book;
			break;
		case 3:
			id = R.drawable.gear;
			break;
		}
//		tab.setIndicator(new MyTabIndicator(this, id, TAB_TITLES[i]));
		tab.setIndicator(TAB_TITLES[i],getResources().getDrawable(id));
		tabs.addTab(tab);
	}
} catch (Exception e) {
	e.printStackTrace();
}
}
//	@Override
//	protected void onCreate(Bundle savedInstanceState) {
//		super.onCreate(savedInstanceState);
//		setContentView(R.layout.layout_home);
//		
//		TabHost tabHost = getTabHost();
//		 
//
//        TabSpec tsPhotos = tabHost.newTabSpec("Photos");
//        tsPhotos.setIndicator("Photos", getResources().getDrawable(R.drawable.landscape));
//        Intent photosIntent = new Intent(this, PhotosActivity.class);
//        tsPhotos.setContent(photosIntent);
// 
//
//        TabSpec tsVideos = tabHost.newTabSpec("Videos");
//        tsVideos.setIndicator("Videos", getResources().getDrawable(R.drawable.movie_1));
//        Intent videosIntent = new Intent(this, VideosActivity.class);
//        tsVideos.setContent(videosIntent);
// 
//
//        TabSpec tsNotes = tabHost.newTabSpec("Notes");
//        tsNotes.setIndicator("Notes", getResources().getDrawable(R.drawable.book));
//        Intent notesIntent = new Intent(this, NotesActivity.class);
//        tsNotes.setContent(notesIntent);
//        
//
//        TabSpec tsSettings = tabHost.newTabSpec("Settings");
//        tsSettings.setIndicator("Settings", getResources().getDrawable(R.drawable.gear));
//        Intent settingsIntent = new Intent(this, SettingsActivity.class);
//        tsSettings.setContent(settingsIntent);
// 
//        // Adding all TabSpec to TabHost
//        tabHost.addTab(tsPhotos);
//        tabHost.addTab(tsVideos);
//        tabHost.addTab(tsNotes);
//        tabHost.addTab(tsSettings);
//	}
}
